<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>title</title>
</head>
<body class="brightLight">
<h1>Ambient Light Sensor</h1>
<div id="details"></div>
<script>
    const details = document.getElementById("details");

    if ('AmbientLightSensor' in window) {
        var sensor = new AmbientLightSensor();
        sensor.onreading = function () {
            alert('Current light level:', sensor.illuminance)
            console.log('Current light level:', sensor.illuminance);
        };
        sensor.onerror = function (event) {
            console.log(event.error.name, event.error.message);
        };
        sensor.start();
    } else {
      alert("no")
    }
</script>
</body>
</html>